<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ include file="/manage/system/pageBase.jsp" %>
<%@ taglib uri="http://shiro.apache.org/tags" prefix="shiro"%>
<%@ page info="消息管理" %>

<style>
    table {
        table-layout: fixed; /* 只有定义了表格的布局算法为fixed，下面td的定义才能起作用。 */
        width:100%;
    }

    td {
        word-break: keep-all; /* 不换行 */
        white-space: nowrap; /* 不换行 */
        overflow: hidden; /* 内容超出宽度时隐藏超出部分的内容 */
        text-overflow: ellipsis; /* 当对象内文本溢出时显示省略标记(...) ；需与overflow:hidden;一起使用*/
    }

</style>
<form action="<%=path%>/manage/message" method="post"  name="list">
    <div style="height:auto!important;height:550px;min-height:550px;">
        <h3 style="border-bottom: 1px solid #D7D7D7;color: #666666;font-size: 28px;padding-bottom: 20px;margin-bottom: 30px;">
            <%=getServletInfo()%>
        </h3>
        <div class="filter">
            <div style="float: left">
                <select id="status" name="status">
                    <option value="">状态</option>
                    <option value="1"  <c:if test="${e.status eq '1'}"> selected="selected"</c:if> >已查看</option>
                    <option value="0"  <c:if test="${e.status eq '0'}"> selected="selected"</c:if> >未查看</option>
                </select>

                <td  style="width: 126px; height: 30px">
                    <input type="text" class="Wdate" id="d1" name="starttime" value="<%=request.getParameter("starttime")==null?"":request.getParameter("starttime")%>" onFocus="var d2=$dp.$('d2');WdatePicker({onpicked:function(){d2.focus();},maxDate:'#F{$dp.$D(\'d2\')}'})" />
                </td>
                至
                <td  style="width: 126px; height: 30px">
                    <input type="text" class="Wdate" id="d2" name="endtime" value="<%=request.getParameter("endtime")==null?"":request.getParameter("endtime")%>" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'d1\')}'})"/>
                </td>

                <button method="selectList" class="btn btn-info" style="padding:0px 5px;margin-top: -4px;"
                        onclick="selectList(this)">
                    <i class="icon-search"></i>查询
                </button>

            </div>
        </div>
        <shiro:hasPermission name="message:export">
            <button method="export" class="btn btn-primary" style="padding:0px 5px;margin-top: -4px;float:right;"
                    onclick="return exportMes(this)">
                <i class="icon-plus"></i>导出
            </button>
        </shiro:hasPermission>
        <table class="table table-bordered table-hover table-striped" >
            <tr >
                <th width="50"><input type="checkbox" id="firstCheckbox"/></th>
                <th width="8%">标题</th>
                <th width="8%">姓名</th>
                <%--<th width="5%">性别</th>--%>
                <th width="8%">联系电话</th>
                <th width="8%">微信号</th>
                <th width="8%">电子邮箱</th>
                <th width="5%">状态</th>
                <th width="10%">提交时间</th>
                <th width="30%">需求描述</th>
                <th width="10%" align="center">操作</th>
            </tr>
            <c:forEach var="item" items="${pager.list}">
                <tr>
                    <td><input type="checkbox" name="ids"
                               value="${item.id}"/></td>
                    <td>${item.title}</td>
                    <td>${item.name}</td>
                    <%--<td>--%>
                        <%--<c:choose>--%>
                            <%--<c:when test="${item.gender eq 'f'}">--%>
                                <%--女--%>
                            <%--</c:when>--%>
                            <%--<c:otherwise>--%>
                                <%--男--%>
                            <%--</c:otherwise>--%>
                        <%--</c:choose>--%>
                    <%--</td>--%>
                    <td>${item.tel}</td>
                    <td>${item.wechatno}</td>
                    <td>${item.email}</td>
                    <td>
                        <c:choose>
                            <c:when test="${item.status eq '0'}">
                                未查看
                            </c:when>
                            <c:otherwise>
                                已查看
                            </c:otherwise>
                        </c:choose>
                    </td>
                    <td>${item.leavetime}</td>
                    <td title="${item.content}">${item.content}</td>
                    <td>
                        <shiro:hasPermission name="message:toEdit">
                            <a href="toEdit?id=${item.id}">查看</a>&ensp;
                        </shiro:hasPermission>
                        <shiro:hasPermission name="message:toDel">
                            <a href="toDel?id=${item.id}">删除</a>
                        </shiro:hasPermission>
                    </td>
                </tr>
            </c:forEach>
            <tr>
                <td colspan="71" style="text-align: center;">
                    <%@ include file="/manage/system/page.jsp" %>
                </td>
            </tr>
        </table>
    </div>
</form>
<script type="text/javascript" src="<%=path%>/resource/My97DatePicker/WdatePicker.js"></script>
<script>
    $(function () {
        $("#firstCheckbox").on("click", function () {
            if ($(this).prop("checked")) {
                $("input[type=checkbox]").prop("checked", true);
            } else {
                $("input[type=checkbox]").prop("checked", false);
            }
        });
    });

    function exportMes(obj) {
        if ($("input:checked").size() == 0) {
            alert("请先选择要导出的数据！");
            return false;
        }else {
            var _form = $("form");
            _form.attr("action", $(obj).attr("method"));
            _form.submit();
        }
    };
    //查询
    function selectList(obj) {
        var _form = $("form");
        _form.attr("action", $(obj).attr("method"));
        _form.submit();
    }
</script>
<%@ include file="/manage/system/baseFoot.jsp" %>